package teacher

import (
	"anban/controllers"
	"anban/service"
	"github.com/astaxie/beego"
	"html/template"
	"strconv"
)

type CourseNoticeController struct {
	controllers.BaseController
}

func (c *CourseNoticeController) ShowList() {
	c.Data["title"] = "课程历史"
	c.Data["xsrfdata"] = template.HTML(c.XSRFFormHTML())
	c.TplName = "teacher/course-history.html"
}

func (c *CourseNoticeController) LoadMore() {
	count, _ := beego.AppConfig.Int("loadcount")
	curPage, _ := strconv.Atoi(c.GetString("p"))
	if curPage <= 0 {
		curPage = 1
	}

	p := map[string]interface{}{}
	p["relation"] = true
	p["convert"] = true
	p["userId"] = c.GetSession("userId")
	p["curPage"] = curPage
	p["perCount"] = count

	_, c.Data["courseList"] = service.GetWeekCourseList(p)
	c.TplName = "teacher/course-history-list.html"
}
